package com.qf.cardlikeboot.request;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Request<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Request<T> success(Integer code,String msg,T data){
        return new Request<>(code,msg,data);
    }

    public static <T> Request<T> success(T data){
        return success(0,"成功",data);
    }

    public static <T> Request<T> success(){
        return success(null);
    }

    public static <T> Request<T> fail(Integer code,String msg,T data){
        return new Request<>(code,msg,data);
    }

    public static <T> Request<T> fail(T data){
        return fail(-1,"失败",data);
    }

    public static <T> Request<T> fail(){
        return fail(null);
    }


}
